package de.gameduell.framework.facebook.app.popups {
	import de.gameduell.framework.debug.Debug;
	import de.gameduell.framework.gui.util.Formatter;

	import flash.events.Event;

	public class HighscorePopup extends PyramidBasePopup {
		public function HighscorePopup() {
			super("newHighscorePopup", "newHighscorePopup", 0, false);
			var taskId:String = String(controller.lastGameResult.taskId);
			localeData.setValue("stageId", taskId);
			
			localeData.setValue("totalScore", Formatter.formatNumberEnglish(String(controller.gameData.pyramid.totalScore)));
			localeData.setValue("brickOneScore", Formatter.formatNumberEnglish(String(controller.gameData.pyramid.bricks["1"].score)));
			localeData.setValue("brickTwoScore", Formatter.formatNumberEnglish(String(controller.gameData.pyramid.bricks["2"].score)));
			
			localeData.setValue("currentBrickScore", Formatter.formatNumberEnglish(String(controller.gameData.pyramid.bricks[taskId].score)));
			
			registerButton("okButton", postToWall);
			registerButton("skipButton", hide);
		}
		
		private function postToWall(event:Event):void {
			Debug.trace("HighscorePopup::postToWall 1", Debug.DEBUG);
			controller.postScoreToWall();
			Debug.trace("HighscorePopup::postToWall 2", Debug.DEBUG);
			hide();
		}
	}
}